from django.db import models
from django.contrib.auth.models import User


# Create your models here.
class AppList(models.Model):
    id = models.IntegerField(primary_key=True)
    app_name = models.CharField(max_length=30)
    app_type = models.CharField(max_length=30)
    app_role = models.CharField(max_length=30, default="管理员")
    app_config = models.BooleanField()
    app_href = models.CharField(max_length=200, null=True)
    app_icon = models.CharField(max_length=200, null=True)

    class Meta:
        verbose_name = "app列表"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.app_name


class Employee(models.Model):
    user = models.OneToOneField(User, related_name='detail', on_delete=models.CASCADE)
    job_number = models.CharField(max_length=100)
    name = models.CharField(max_length=100)
    department = models.CharField(max_length=100)
    role = models.CharField(max_length=100)
    phone = models.CharField(max_length=100, default="")

    class Meta:
        verbose_name = "用户信息"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
